<template>
  <div class="white-box">

    <el-tabs v-model="tabsActive" type="card">
      <template v-for="(item, index) in selectOptions.itemStatus">
        <el-tab-pane :label="item.label" :name="item.value"></el-tab-pane>
      </template>
    </el-tabs>

    <el-table class="table-mb" v-loading="loading" :data="list" :header-cell-style="{ background: '#F5F7FA' }"
              element-loading-background="rgba(255, 255, 255, 0.6)" row-key="sid">
      <el-table-column prop="id" label="队伍号"></el-table-column>
<!--      <el-table-column prop="configKey" label="参数名称"></el-table-column>-->
<!--      <el-table-column prop="configValue" label="参数键值" :show-overflow-tooltip="true"></el-table-column>-->
<!--      <el-table-column prop="note" label="备注"></el-table-column>-->
      <el-table-column align="center" prop="itemStatus" label="状态" >
        <template #default="{ row }">
          <el-text v-if="row.itemStatus === 0" type="success">进行中</el-text>
          <el-text v-else-if="row.itemStatus === 1" type="primary">已完成</el-text>
          <el-text v-else-if="row.itemStatus === 2" type="warning">等待中</el-text>
          <el-text v-else type="info"></el-text>
        </template>
      </el-table-column>
      <el-table-column prop="created" label="创建时间"> </el-table-column>
      <el-table-column label="操作" width="180" fixed="right">
        <template #default="{ row }">
          <el-button link type="primary" @click="toDetail(row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
        background
        v-model:current-page="page"
        v-model:page-size="pageSize"
        :page-sizes="pageSizeNum"
        :total="totalNums"
        layout="total, sizes, prev, pager, next, jumper"
    >
    </el-pagination>

    <go-back/>
  </div>
</template>

<script setup>
import {
  getCurrentInstance,
  ref,
  reactive,
  onMounted,
  watch,
  computed
} from "vue"
import listMixins from "@mixins/hook/list"
import {
  useRouter
} from "vue-router"
import {
  CirclePlus, Search
} from "@element-plus/icons-vue"
import GoBack from "@components/GoBack.vue"
const router = useRouter()
const {
  proxy
} = getCurrentInstance()

/**
 * minxin列表加载
 */
const {
  page,
  pageSizeNum,
  pageSize,
  loading,
  totalNums,
  searchParams,
  searchBtnLoading,
  apiPath,
  list,
  dialogFormRef,
  dialogShow,
  dialogForm,
  dialogParams,
  handleSearch,
  getData,
  handleAdd,
  handleEdit,
  resetDialogForm,
  handleAllSelected,
  submitDialogForm,
  closeDialog,
  handleAction,
  handleDelete
} = listMixins()

const selectOptions = reactive({
  // 团队状态 0=未完成 1=已完成
  itemStatus:[
    {label:'进行中',value:0},
    {label:'已完成',value:1},
    {label:'等待中',value:2},
  ],
})
const tabsActive = ref(0)
apiPath.value = '/item/team-info';
searchParams.itemStatus = computed(()=>{
  return tabsActive.value
})

watch(tabsActive,()=>{
  page.value = 1
  getData()
})
onMounted(() => {
  getData()
})
const toDetail = (row) =>{
  router.push({
    path: "/Team/TeamDetail",
    query: {
      sid:row.sid
    }
  })
}
</script>

<style lang="less">

</style>